﻿using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SU.Center.Infa;

namespace SU.Center.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TraceabilityController : ControllerBase
    {
        private readonly IMediator  mediator;

        public TraceabilityController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        //产品
        [HttpGet]
        public async Task<ApiResult> GetProduct([FromQuery]GetProductReqsultDto tntity)
        {
            return await mediator.Send(tntity);
        }

   
        //新增产品
        [HttpPost]
        public async Task<ApiResult> InsetInformation(InsetInformationDto tntity)
        {
            return await mediator.Send(tntity);
        }

        //显示信息
        [HttpGet]
        public async Task<ApiResult> GetInformation([FromQuery] GetInformationReqsultDto tntity)
        {
            return await mediator.Send(tntity);
        }

        //删除信息
        [HttpGet]
        public async Task<ApiResult> DelInformation([FromQuery] DelInformationRequestDto tntity)
        {
            return await mediator.Send(tntity);
        }

        [HttpGet]
        public async Task<ApiResult> GetnnowInformation([FromQuery] GetnowInformationResultDto tntity)
        {
            return await mediator.Send(tntity);
        }

    }
}
